Skip to content

Convert degenerate torus (A=0, B=C) to sphere #63

Merged
paulromano merged 2 commits into
openmc-dev:mainfrom
giovanni-mariano:main
May 1, 2026
Merged

Convert degenerate torus (A=0, B=C) to sphere #63
paulromano merged 2 commits into
openmc-dev:mainfrom
giovanni-mariano:main

Conversation

@giovanni-mariano
Copy link
Copy Markdown
Contributor

When an MCNP torus surface has A=0 and B=C, it geometrically degenerates to a sphere of radius B centered at (x0, y0, z0). OpenMC's torus surfaces don't accept A=0 (see openmc-dev/openmc#3813), so these cases (rare) previously produced an invalid surface.

Added test_torus_degenerate_sphere in tests/test_surfaces.py, parametrized over tx/ty/tz, asserting the result is an openmc.Sphere with the expected center and radius. The existing test_torus cases still pass (non-degenerate parameters continue to produce XTorus/YTorus/ZTorus).

Copy link
Copy Markdown
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@paulromano paulromano enabled auto-merge (squash) May 1, 2026 19:09
@paulromano paulromano merged commit 8168125 into openmc-dev:main May 1, 2026
1 check passed
@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.20%. Comparing base (243a994) to head (487d6fa).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #63      +/-   ##
==========================================
- Coverage   87.23%   87.20%   -0.04%     
==========================================
  Files           3        3              
  Lines         752      750       -2     
  Branches      198      197       -1     
==========================================
- Hits          656      654       -2     
  Misses         52       52              
  Partials       44       44              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants